import type {
  addAddr,
  orderInfo,
  AddrDetail,
  LogisticsDetail
} from '@/types/order'
import { request } from '@/utils/request'
// 查询收货地址
export const getReceive = () => {
  return request<orderInfo[]>('patient/order/address')
}
// 添加收货地址
export const addAddress = (addr: addAddr) => {
  return request<{ id: string }>('patient/order/address', 'POST', addr)
}
// 修改收货地址
export const editAddress = (id: string, addr: addAddr) => {
  return request<{ id: string }>(`patient/order/address/${id}`, 'PUT', addr)
}
// 删除收货地址
export const delAddress = (id: string) => {
  return request<{ id: string }>(`patient/order/address/${id}`, 'DELETE')
}
// 查询收货地址详情
export const getAddrDetail = (id: string) => {
  return request<AddrDetail>(`patient/order/address/${id}`)
}
// 查询物流信息
export const getLogisticsDetail = (id: string) => {
  return request<LogisticsDetail>(`patient/order/${id}/logistics`)
}
